01. Practice: Apply What You've Learned

Practice Debugging

This practice session will focus on debugging, which is one of the five ways programmers think. Python requires code be written with a very specific syntax. This means that small typos can lead to big problems!

In each of the following exercises, you'll be given code. Sometimes the code will work and sometimes it won't. For each exercise, do the following:

  1. Read through the code and try to predict what it is supposed to do.
  2. Make a guess about whether or not it will actually work.
  3. Without modifying the code yet, press the Test Run button.
  4. Observe the output that's displayed.
  5. If there's an error message, read through it.
  6. These error messages are usually very cryptic. That's okay. Go through each message and try to decipher what the actual problem was. If you can figure it out, fix the code and then press Test Run again.

HINT: It's often a good idea to start at the last line of the error message.

Debugging!

Debugging!